{% extends "topic/base.html" %}
{% block title %}设置{% endblock%}
{% block main %}

<div id="main">
  <div id="sidebar">
    <div class="panel">
        <div class="header">
          <span class="col_fade">个人信息</span>
        </div>
        <div class="inner">
          <div class="user_card">
            <div>
                <a class="user_avatar" href="{{ url_for('.profile') }}">
                  <img src="{{ user.image }}" title="{{ user.username }}">
                </a>
                <span class="user_name">
                    <a class="dark" href="{{ url_for('.profile') }}">
                        {{ user.username }}
                    </a>
                </span>
                <div class="space clearfix"></div>
                <span class="signature">
                    {{ user.signature }}
                </span>
            </div>
          </div>
        </div>
    </div>

    <div class="panel">
        <div class="inner">
          <a href="/topic/new?board_id=-1" id="create_topic_btn">
            <span class="span-success">发布话题</span>
          </a>
        </div>
    </div>
  </div>

  <div id="content">
    <div class="panel">
        <div class="header">
          <ul class="breadcrumb">
            <li><a href="{{ url_for('index.profile') }}">主页</a><span class="divider">/</span></li>
            <li class="active">设置</li>
          </ul>
        </div>
        <div class="inner">
          <form id="setting_form" class="form-horizontal" action="{{ url_for('.change') }}" method="post">
            <div class="control-group">
              <label class="control-label" for="name">用户名</label>

              <div class="controls">
                <input class="input-xlarge" id="name" name="username" size="30" type="text" value="{{ user.username }}">
              </div>
            </div>
            <div class="control-group">
              <label class="control-label" for="signature">个性签名</label>

              <div class="controls">
                <input class="input-xlarge" id="signature" name="signature" size="30" type="text" value="{{ user.signature }}">
              </div>
            </div>
            <div class="control-group">
              <label class="control-label" for="signature">邮箱</label>

              <div class="controls">
                <input class="input-xlarge" id="email" name="email" size="30" type="text" value="{{ user.email }}">
              </div>
            </div>
            <input type="hidden" id="action" name="action" value="change_setting">
            <input type="hidden" name="_csrf" value="ponoP4Xc-UNEN_zT6A01cqh3VKGRwTDkWaGw">

            <div class="form-actions">
              <input type="submit" class="span-primary submit_btn" data-loading-text="保存中.." value="保存设置">
            </div>
          </form>
        </div>
    </div>

    <div class="panel">
        <div class="header">
          <span class="col_fade">更改密码</span>
        </div>
        <div class="inner">
          <form id="change_pass_form" class="form-horizontal" action="{{ url_for('.change_pass') }}" method="post">
            <div class="control-group">
              <label class="control-label" for="old_pass">当前密码</label>

              <div class="controls">
                <input class="input-xlarge" type="password" id="old_pass" name="old_pass" size="30">
              </div>
            </div>
            <div class="control-group">
              <label class="control-label" for="password">新密码</label>

              <div class="controls">
                <input class="input-xlarge" type="password" id="password" name="password" size="30">
              </div>
            </div>

            <div class="form-actions">
              <input type="submit" class="span-primary submit_btn" data-loading-text="更改中.." value="更改密码">
            </div>
          </form>
    </div>
    </div>

    <div class="panel">
        <div class="header">
          <span class="col_fade">上传头像</span>
        </div>
        <div class="inner">
            <form method="post"
                action="{{ url_for('.avatar_add')}}"
                enctype="multipart/form-data"
            >
                <input type="file" name="avatar">
                <button type="submit">上传头像</button>
            </form>
        </div>
    </div>
  </div>

</div>

{% endblock %}